using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace WcfService1.DTO
{
    [DataContract]
    public class JurnalPembelianDetailDTO : INotifyPropertyChanged
    {
        private String _AccountNumber;
        private Decimal _Debit;
        private DepartemenDTO _Departemen;
        private String _Description;
        private Guid _JurnalPembelianDetailId;
        private Decimal _Kredit;

        [DataMember]
        public Guid JurnalPembelianDetailId
        {
            get { return _JurnalPembelianDetailId; }
            set
            {
                _JurnalPembelianDetailId = value;
                RaisePropertyChanged("JurnalPembelianDetailId");
            }
        }


        [DataMember]
        public CoaDTO Coa
        {
            get { return _Coa; }
            set
            {
                _Coa = value;
                RaisePropertyChanged("Coa");
            }
        }


        [DataMember]
        public Decimal Debit
        {
            get { return _Debit; }
            set
            {
                _Debit = value;
                RaisePropertyChanged("Debit");
            }
        }


        [DataMember]
        public Decimal Kredit
        {
            get { return _Kredit; }
            set
            {
                _Kredit = value;
                RaisePropertyChanged("Kredit");
            }
        }


        [DataMember]
        public String Description
        {
            get { return _Description; }
            set
            {
                _Description = value;
                RaisePropertyChanged("Description");
            }
        }


        [DataMember]
        public DepartemenDTO Departemen
        {
            get { return _Departemen; }
            set
            {
                _Departemen = value;
                RaisePropertyChanged("Departemen");
            }
        }

        public ObservableCollection<CoaDTO> Coas
        {
            get { return _Coas; }
            set
            {
                if (ReferenceEquals(Coa, value) || value == null) return;
                _Coas = value;
                RaisePropertyChanged("Coas");
            }
        }

        public ObservableCollection<DepartemenDTO> Departemens
        {
            get { return _Departemens; }
            set
            {
                if (ReferenceEquals(Departemens, value) || value == null) return;
                _Departemens = value;
                RaisePropertyChanged("Departemens");
            }
        }

        public int No
        {
            get { return _No; }
            set
            {
                _No = value;
                RaisePropertyChanged("No");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        private int _No;
        private CoaDTO _Coa;
        private ObservableCollection<CoaDTO> _Coas;
        private ObservableCollection<DepartemenDTO> _Departemens;

        #endregion

        protected void RaisePropertyChanged(string propertyname)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}